package com.commander.spring.cloud.config.sentinel.rule;

import com.alibaba.cloud.sentinel.datasource.config.NacosDataSourceProperties;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * description:
 * <p>
 * Date: 2020-09-07
 * <p>
 * Time: 17:19
 *
 * @author zhangxin
 */
@Configuration
public class NacosRuleConfig {
	
	public static final String FLOW_RULE_NACOS_CONFIG = "flowRuleNacosConfig";
	@Bean(FLOW_RULE_NACOS_CONFIG)
	@ConfigurationProperties(prefix = "spring.cloud.sentinel.datasource.flow.nacos")
	public NacosDataSourceProperties flowRuleNacosConfig() {
		return new NacosDataSourceProperties();
	}
	
	public static final String DEGRADE_RULE_NACOS_CONFIG = "degradeRuleNacosConfig";
	@Bean(DEGRADE_RULE_NACOS_CONFIG)
	@ConfigurationProperties(prefix = "spring.cloud.sentinel.datasource.degrade.nacos")
	public NacosDataSourceProperties degradeRuleNacosConfig() {
		return new NacosDataSourceProperties();
	}
	
	public static final String SYSTEM_RULE_NACOS_CONFIG = "systemRuleNacosConfig";
	@Bean(SYSTEM_RULE_NACOS_CONFIG)
	@ConfigurationProperties(prefix = "spring.cloud.sentinel.datasource.system.nacos")
	public NacosDataSourceProperties systemRuleNacosConfig() {
		return new NacosDataSourceProperties();
	}
	
	public static final String AUTH_RULE_NACOS_CONFIG = "authorityRuleNacosConfig";
	@Bean(AUTH_RULE_NACOS_CONFIG)
	@ConfigurationProperties(prefix = "spring.cloud.sentinel.datasource.authority.nacos")
	public NacosDataSourceProperties authorityRuleNacosConfig() {
		return new NacosDataSourceProperties();
	}
	
	public static final String PARAM_FLOW_RULE_NACOS_CONFIG = "paramFlowRuleNacosConfig";
	@Bean(PARAM_FLOW_RULE_NACOS_CONFIG)
	@ConfigurationProperties(prefix = "spring.cloud.sentinel.datasource.param-flow.nacos")
	public NacosDataSourceProperties paramFlowRuleNacosConfig() {
		return new NacosDataSourceProperties();
	}
	
}
